package urjc.as.emergencies.client.testing;

import org.restlet.data.Response;

import urjc.as.emergencies.client.CommToolkit;
import urjc.as.emergencies.data.Ambulance;

public class ClientTest {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Ambulance ambulance = new Ambulance();
		ambulance.setStatus(Ambulance.LIBRE);
		
		//Crear una nueva ambulancia
		
		Response response = CommToolkit.createAmbulance(ambulance, "http://localhost:8080/ambulancias");
		String s = response.getLocationRef().toString();
		System.out.println("New location: " + s);
		
		//Obtener la representacion de la nueva ambulancia
		Ambulance a = (Ambulance) CommToolkit.getRepresentation(s);
		System.out.println(a.serializar());
		
		//Hago un patch para cmbiar el estado de la ambulancia
		CommToolkit.actualizaRepresentacion("http://localhost:8080/ambulancias/345", "estado", "12asdasd");

		//Obtener la representacion de la nueva ambulancia
		Ambulance b = (Ambulance) CommToolkit.getRepresentation(s);
		System.out.println(b.serializar());
	}

}
